<!-- BEGIN:main -->


<!-- BEGIN:javascript -->
<script type="text/javascript">
    $(document).ready(function() {


        // sự kiện nhấn nút search sản phẩm
        $('#btItemSearch').click(function() {

            var txtSearch = $('#txtItem').val();
            var slPrice = $('#slPrice').val();
            var slProperties = $('#slProperties').val();

            searchItem(txtSearch, slPrice, slProperties);

        });


        // sự kiện nhấn nút search bài viết
        $('#btArticleSearch').click(function() {
            var txtSearch = $('#txtArticle').val();
            searchArticle(txtSearch);





        });



        searchItem('{SEARCH_TEXT}', '', '');

        searchArticle('{SEARCH_TEXT}');




        function searchItem(searchText, price, property) {
            var txtSearch = searchText;
            var slPrice = price;
            var slProperties = property;
            var dataString = 'txtSearch=' + txtSearch + '&slPrice=' + slPrice + '&slProperties=' + slProperties + '&hdAction=searchItem';
            $.ajax({
                type: "POST",
                data: dataString,
                cache: false,
                beforeSend: function()
                {
                    $("#flash").show();
                    $("#flash").html('<img src="./templates/default/images/loading.gif" />');
                    $('#itemList').html('');
                },
                success: function(html) {
                    $("#itemList").html(html);
                    $("#flash").hide();
                }
            });
        }



        function searchArticle(searchText) {
            var txtSearch = searchText;

            var dataString = 'txtTextSearch=' + txtSearch + '&hdAction=searchArticle';
            $.ajax({
                type: "POST",
                data: dataString,
                cache: false,
                beforeSend: function()
                {
                    $("#flash").show();
                    $("#flash").html('<img src="./templates/default/images/loading.gif" />');
                    $('#articleList').html('');

                },
                success: function(html) {
                    $("#articleList").html(html);
                    $("#flash").hide();
                }
            });
        }







        $('#tabBaiViet').click(function() {
            $('#tabSanPham').removeClass("d_tab_active");
            $(this).addClass("d_tab_active");

            $('#article').show();
            $('#item').hide();
        });


        $('#tabSanPham').click(function() {
            $('#tabBaiViet').removeClass("d_tab_active");
            $(this).addClass("d_tab_active");

            $('#article').hide();
            $('#item').show();
        });




    });
</script>
<!-- END:javascript -->



<!-- BEGIN:layout -->
<style>
    .d_tab {
        float: left;
        margin-right: 5px;
        padding: 10px;
    }
    a.d_tab:link,
    a.d_tab:visited{
        color: #b9a477;
        font-weight: bold;
    }
    .d_tab_active{
        border-bottom: 2px solid #D0491C;
    }
</style>


<div class="d_component">

               
            <div class="d_title_component1" style="text-align: left">
                Kết quả tìm kiếm
            </div>
     


    <div class="d_divide20"></div>


    <a class="d_tab d_tab_active" id="tabBaiViet" href="javascript:void()" style="margin-left:10px"> Bài viết</a>

    <a class="d_tab" id="tabSanPham" href="javascript:void()" > Sản phẩm</a>



    <div class="d_clear"></div>

    <div class="d_divide10"></div>


    <div class="d_content_component" id="item" style="display: none;margin-left:10px;margin-bottom:20px;margin-top:10px">	

        <div style="text-align: left; line-height: 25px;" >
            <div class="d_label" style="width: 110px">Tên Sản phẩm</div>
            <input  name="txtItem" id="txtItem" class="form-input"  value="{SEARCH_TEXT}" style="width: 200px">
            <select class="form-input" style="width: 200px;height: 35px;"  name="slPrice" id="slPrice">
                <option value="">-- Chọn mức giá --</option>
                <option value="0-500000">Dưới 500</option>
                <option value="500000-1000000">Từ 500 - 1 triệu</option>
                <option value="1000000-1500000">1 triệu - 1 triệu 500</option>
                <option value="1500000-2000000">1 triệu 500 - 2 triệu</option>
                <option value="2000000-2500000">2 triệu - 2 triệu 500</option>
                <option value="2500000-3000000">2 triệu 500 - 3 triệu</option>
                <option value="3000000-100000000">Trên 3 triệu</option>
            </select> 


            <select class="form-input" style="width: 200px;height: 35px;"  name="slProperties" id="slProperties">
                <option value="" selected>-- Chọn thuộc tính--</option>
                <!-- BEGIN:property_list -->
                <option value="{PROPERTY_VALUE}">{PROPERTY_NAME}: {PROPERTY_VALUE}</option>
                <!-- END:property_list -->
            </select> 

            <a class="d_button d_border_radius10" href="javascript:void()" id="btItemSearch">Tìm kiếm</a>

        </div>    



        <div class="d_divide10"></div>
        <div class="d_divide10"></div>


        <form action="./com_cart.htm" method="post" id="frmItem">  
            <input type="hidden" name="hdItemID" id="hdItemID" value=""/>
            <input type="hidden" name="hdAction" id="hdAction" value=""/>
            <div id="flash"></div>

            <div id="itemList"></div>                       

        </form>        
        <div class="d_clear"></div>
    </div>







    <div class="d_content_component" id="article" style=";margin-left:10px;margin-bottom:20px">	

        <div style="text-align: left; line-height: 25px">
            <div style="font:500 14px arial;font-weight: 500;corlor:#333">Nếu muốn tìm chính xác câu cần tìm thì để dấu " bao quanh câu (VD: "câu văn đầy đủ")</div>
            <div class="d_label" style="font:500 14px arial;font-weight: 500;corlor:#333;width: 110px" >Từ khóa cần tìm</div>
            <input  class="form-input" name="txtArticle" id="txtArticle"  value="{SEARCH_TEXT}" style="width: 200px">
            <a class="d_button"  href="javascript:void()" id="btArticleSearch">Tìm kiếm</a>
        </div>    


        <div class="d_divide10"></div>
        <div class="d_divide10"></div>


        <form action="./com_cart.htm" method="post" id="frmItem">  
            <input type="hidden" name="hdItemID" id="hdItemID" value=""/>
            <input type="hidden" name="hdAction" id="hdAction" value=""/>
            <div id="flash"></div>

            <div id="articleList"></div>                       
        </form>        
        <div class="d_clear"></div>
    </div>

</div>
<div class="d_divide20"></div>
<!-- END:layout -->




<!-- BEGIN:article_list -->
<!--<script>
    $(document).ready(function() {
        $(".mo_ta_bai_viet").each(function() {
            alert($(this).html());
        });
    });
</script>-->
<div class="d_article" style="min-height: 130px; height:auto !important; ">
    <!-- BEGIN:article_image -->
    <img src="{ARTICLE_IMAGE}" alt="{ARTICLE_TITLE}"/>
    <!-- END:article_image -->

    <div class="d_divide3"></div>

    <div class="d_title">
        <a href="./com_content/articles/{ARTICLE_ALIAS}/{ARTICLE_ID}.htm">{ARTICLE_TITLE}</a>
    </div>

    <div class="d_divide3"></div>

    <div class="d_date">{ARTICLE_DATE}</div>
    <div class="d_divide3"></div>
    <div class="d_description">{ARTICLE_DESCRIPTION}</div>                    
</div> 
<!-- END:article_list -->










<!-- BEGIN:item_list-->
<script type="text/javascript">
    $(document).ready(function() {
        $('.addToCart').click(function() {
            var itemID = $(this).attr('id');
            $('#hdAction').val('addToCart');
            $('#hdItemID').val(itemID);
            $('#frmItem').submit();
        });
    });
</script>

 <div class="d_item">

                
            <a class="d_link d_bold d_size15" href="./com_item/item/{ITEM_ALIAS}/{ITEM_ID}.htm">{ITEM_NAME}</a>
                   

                    <div class="d_thumbnails">
                        <a href="./com_item/item/{ITEM_ALIAS}/{ITEM_ID}.htm">
                            <img src="{ITEM_IMAGE}" />
                        </a>                                                                 
                    </div>

                    <div>
                        <div style="border: 1px dashed #CCC;">
                         <div id="rowWraper" class="row_" >
                            <div id="price_col" class="col" >
                             <!-- BEGIN:price -->
                            <div class="d_price">{ITEM_PRICE}  (VNĐ)</div>   
                            <!-- END:price -->  
                            </div>
                            <div id="ct_col" class="col" >
                             <a class="d_button" href="./com_item/item/{ITEM_ALIAS}/{ITEM_ID}.htm">Chi tiết</a>
                       
                            </div>
                        </div>
                            
                            
                        </div>
                       
                    </div>
                
                
            </div> 

<!-- END:item_list -->

<!-- END:main -->
